
/**
  ******************************************************************************
* @file				cmd.c
* @author			ou_teki
* @encoding			UTF-8 
* @date				2024-0420
  ******************************************************************************
  */

#ifdef __cplusplus
extern "C" {
#endif

#include "cmd.h"

CMD_ST cmd_help[CMD_MAX] = 
{
    {
        .cmd_str ="LED1 ON",
        .cmd_func = NULL,
    },
    {
        .cmd_str ="LED1 OFF",
        .cmd_func = NULL,
    },
    {
        .cmd_str ="LED1 TOGGLE",
        .cmd_func = NULL,
    },
};



uint8_t GetCmdIndex(char* cmd_str)
{
    uint8_t i;
    for(i = 0; i < CMD_MAX; i++)
    {
        if(strcmp(cmd_str, cmd_help[i].cmd_str) == 0)
        {
            if(cmd_help[i].cmd_func!= NULL)
            {
                cmd_help[i].cmd_func();
            }
            return i;
        }
    }
  return CMD_MAX;
}



#ifdef __cplusplus
}
#endif
